﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;

namespace Leffaetsin.Models
{
    public class Movie
    {
        public Movie()
        {
            ShowTimes = new List<string>();
            Genres = new List<string>();
        }

        public string ImdbId { get; set; }
        public string Rating { get; set; }
        public string Title { get; set; }
        public string OriginalTitle { get; set; }
        public string ProductionYear { get; set; }
        public string StrippedTitle { get; set; }
        public string AreaName { get; set; }
        public IEnumerable<string> ShowTimes { get; set; }
        public IEnumerable<string> Genres { get; set; }
        public bool IsBioRexMovie { get; set; }

        // URLS
        public string FinnkinoLink { get; set; }
        public string ImdbLink { get; set; }
        public string ApiUrl { get; set; }

        // PICS
        public string ThumbNailUrl { get; set; }
        public string LargePicUrl { get; set; }

        public string UrlFriendlyName
        {
            get
            {
                // TODO: tästä pitää stripata NV12 pois....
                var title = Title.Replace(":", "").Replace(" ", "_");
                title = Regex.Replace(title, @"\-{2,}", "_");
                return title;

                // TODO: consider:
                /*
                // make it all lower case
                title = title.ToLower();
                // remove entities
                title = Regex.Replace(title, @"&\w+;", "");
                // remove anything that is not letters, numbers, dash, or space
                title = Regex.Replace(title, @"[^a-z0-9\-\s]", "");
                // replace spaces
                title = title.Replace(' ', '-');
                // collapse dashes
                title = Regex.Replace(title, @"-{2,}", "-");
                // trim excessive dashes at the beginning
                title = title.TrimStart(new[] { '-' });
                // if it's too long, clip it
                if (title.Length > 80)
                    title = title.Substring(0, 79);
                // remove trailing dashes
                title = title.TrimEnd(new[] { '-' });
                return title;
                 * */
            }
        }

    }
}